package com.baofu.paycore.service.factory.impl;

import com.baofu.paycore.manager.model.RechargeBO;
import com.baofu.paycore.service.facade.model.PayBaseDTO;
import com.baofu.paycore.service.factory.OrderFactory;
import com.baofu.paycore.service.factory.PayBaseFactory;
import com.baofu.paycore.service.processor.PayBaseProcessor;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

/**
 * 线下充值（线下打款）资金单组装构建工厂
 * <p>
 * </p>
 * User: kwl Date: 2017/3/3 ProjectName: paycore Version: 5.0.0
 */
@Service
public class OfflineRechargeFactoryImpl extends PayBaseFactory implements OrderFactory {

    /**
     * 主单处理器
     */
    @Resource(name = "rechargeProcessor")
    private PayBaseProcessor commonProcessor;

    /**
     * 资金单处理器
     */
    @Resource(name = "rechargeFundProcessor")
    private PayBaseProcessor fundProcessor;

    @PostConstruct
    public void init(){
        processor.add(commonProcessor);
        processor.add(fundProcessor);
    }

    /**
     * 组装支付模型
     *
     * @param payBaseDTO 请求对象
     * @return 支付模型
     */
    @Override
    public RechargeBO build(PayBaseDTO payBaseDTO) {
        RechargeBO rechargeBO = new RechargeBO();
        super.buildBO(rechargeBO,payBaseDTO);
        return rechargeBO;
    }
}
